/**
* 左边菜单
*/ 
<template>
  <el-menu :default-active="this.$route.path" :collapse="collapsed" collapse-transition router  unique-opened class="el-menu-vertical-demo" background-color="#334157" text-color="#fff" active-text-color="#ffd04b">
    <div class="logobox">
      <img class="logoimg" src="../assets/img/logo.png" alt="">
    </div>
    <el-menu-item  v-for="item in allmenu" :key="item.id" :index="item.url">
        <i :class="item.icon" class="iconfont"></i>
        <span slot="title">{{item.menuname}}</span>
    </el-menu-item>
  </el-menu>
</template>
<script>
import {judgeRole} from "../api/role"
export default {
  name: 'leftnav',
  data() {
    return {
      collapsed: false,
      allmenu: []
    }
  },
  // 创建完毕状态(里面是操作)
  created() {
    this.allmenu = judgeRole().data;
    this.$root.Bus.$on('toggle', value => {
      this.collapsed = !value
    })
  }
}
</script>
<style>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 240px;
  min-height: 400px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  border: none;
  text-align: left;
}
.el-menu-item-group__title {
  padding: 0px;
}
.el-menu-bg {
  background-color: #FFC0CB !important;
}
.el-menu {
  border: none;
}
.logobox {
  height: 40px;
  line-height: 40px;
  color: #FFC0CB;
  font-size: 20px;
  text-align: center;
  padding: 20px 0px;
}
.logoimg {
  height: 40px;
}
</style>